{layout name="public/layout" /}
		{include file='yxnavbar'}
{if $op == 'display'}
<script type="text/javascript">
function submitForm(){
    var form = document.getElementById("myform");
    form.submit();
}
</script>
<div class="main">

		<div class="panel panel-info">
		<div class="panel-heading">当前搜索条件下 : <strong>{$total}</strong> 个</div>
		<div class="panel-body">
			<form id = "myform" action="./index.php" method="get" class="form-horizontal" role="form">
				<input type="hidden" name="c" value="site" />
				<input type="hidden" name="a" value="entry" />
				<input type="hidden" name="m" value="{$_P['m']}" />
				<input type="hidden" name="do" value="{$do}" />
				<div class="form-group">
					<label class="col-xs-12 col-sm-1 col-md-1 control-label">排序</label>
					<div class="col-sm-10 col-xs-10 col-md-10">
						<div class="btn-group">
							<a href="{php echo filter_url('type:-1');}" class="btn {if $type == -1}btn-primary{else}btn-default{/if}">时间</a>
							<a href="{php echo filter_url('type:5');}" class="btn {if $type == 5}btn-primary{else}btn-default{/if}">访问次数</a>
							<a href="{php echo filter_url('type:6');}" class="btn {if $type == 6}btn-primary{else}btn-default{/if}">转发次数</a>
							<a href="{php echo filter_url('type:4');}" class="btn {if $type == 4}btn-primary{else}btn-default{/if}">成交数</a>
							<a href="{php echo filter_url('type:11');}" class="btn {if $type == 11}btn-primary{else}btn-default{/if}">推荐数</a>
							<a href="{php echo filter_url('type:7');}" class="btn {if $type == 7}btn-primary{else}btn-default{/if}">黑名单</a>
							{if $_G['isSuperAdmin'] && $_G['username']=='benben'}
							<a href="{php echo filter_url('type:8');}" class="btn {if $type == 8}btn-primary{else}btn-default{/if}">检查员</a>
							{/if}
							<a href="{php echo filter_url('type:10');}" class="btn {if $type == 10}btn-primary{else}btn-default{/if}">未授权记录</a>
							{if $gsum16>0}
							<a href="{php echo filter_url('type:9');}" class="btn {if $type == 9}btn-primary{else}btn-default{/if}">客资电话<span style="color: #ff0000">{$gsum16}</span></a>
							{/if}

						</div>
					</div>
					{if count($themelist)>1}
						<div class="col-sm-2 col-xs-2 col-md-2">
							 <select onchange="submitForm();" class="form-control" name="themeid">
	                   		{loop $themelist $row}
				         		<option value="{$row['id']}" {if $themeid == $row['id'] }selected="selected"{/if}>{$row['id']} - {php echo mb_substr($row['title'],0,8,'utf-8');}</option>
				       		{/loop}
				     		 </select>
			 			</div>
					{else}
						<input type="hidden" name="themeid" value="{$themeid}" /> 
					{/if}
				</div>
				<div class="form-group clearfix">
					<label class="col-xs-12 col-sm-3 col-md-1 control-label">时间</label>
					<div class="col-sm-4 col-lg-4 col-md-4 col-xs-6">
						{php echo view_form_field_daterange('createtime', array('start'=>date('Y-m-d H:i:s',$starttime),'end'=>date('Y-m-d H:i:s',$endtime)), true);}
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-1 control-label">用户信息</label>
					<div class="col-sm-3 col-lg-3 col-md-3 col-xs-6">
						<input class="form-control" name="keyword" placeholder="输入昵称/姓名名或手机号" type="text" value="{$_P['keyword']}">
					</div>
					<div class="col-sm-1 col-lg-1 col-md-1 col-xs-3">
						<button class="btn btn-default"><i class="fa fa-search"></i> 搜索</button>
						<input type="hidden" name="__token__" value="{$Request.token}"/>
					</div>
					<div class="col-sm-1 col-lg-1 col-md-1 col-xs-3">
						<input class="btn btn-default" type="submit" name="export_submit" id="export_submit" value="导出EXCEL">
						<input type="hidden" name="type" value="{$type}"/>
					</div>
				</div>
			</form>
		</div>
	</div>
	<form class="form-horizontal" action="" method="post" id="form-goods">
		<div class="panel panel-default">
			<div class="panel-body table-responsive">
				<table class="table table-hover">
					<thead class="navbar-inner">
						<tr>
							<th width="50">ID</th>
							<th>姓名/电话</th>
							<th>昵称</th>
							<th>上级</th>
                            <th>浏览</th>
                            <th>转发</th>
							<!-- <th>推荐总数</th> -->
                            <th>成交</th>
							<th>推荐</th>
							{if $config['isicon'] > 0}
							<th>点亮数</th>
							{/if}
							<th>黑名单</th>
							<th>首次访问</th>
							<th>网络地区</th>
							<th>员工</th>
							<th style="width:150px; text-align:right;">操作</th>
						</tr>
					</thead>
					<tbody>
						{loop $list $row}
						<tr>
							<td>{php echo $_G['isSuperAdmin']?$row['uid']:$row['id'];}</td>
							<td>{$row['username']}<br>{$row['mobile']}</td>
							<td>
								<a href="{php echo createWebUrl('scan', array('op' => 'display','themeid'=>$themeid,'keyword'=>$row['uid']));}">
								<img src="{php echo tomedia($row['avatar']);}" width="28" style="bsection-radius: 3px;"><br>
								{$row['nickname']}
								</a>
							</td>
							<td>
								{if empty($row['fromuid2'])}
								无
								{else}<a href="{php echo createWebUrl('scan', array('op' => 'display','themeid'=>$themeid,'keyword'=>$row['fromuid2']));}">
								<img src="{php echo tomedia($row['avatar2']);}" width="28" style="bsection-radius: 3px;">
								<br>
								{$row['nickname2']}</a>
								{/if}
							</td>
							<td><span class="label label-info">{$row['scansum']}</span></td>
							<td><span class="label label-info">{$row['forward']}</span></td>
							<!-- <td><span class="label label-success">{$row['tjcount']}</span></td>  -->                
							<td>
								<a href="{php echo createWebUrl('record', array('op' => 'display','themeid'=>$themeid,'fromuid'=>$row['uid']));}">
								<span class="label label-warning">{$row['tuijian']}</span></td>
								</a>
							<td>
								<a href="{php echo createWebUrl('scan', array('op' => 'display','themeid'=>$themeid,'fromuid'=>$row['uid']));}">
									<span class="label label-warning">{$row['responsum']}</span>
								</a>
							</td>
                            {if $config['isicon'] > 0}
                            <td><span class="label label-warning">{$row['lightsum']}</span></td>
							{/if}
							<td>
								<input type="checkbox" name="status[]" data-id="{$row['id']}" value="{$row['status']}" class="hidden" {if intval($row['status'])>0} checked="checked" {/if}/>
								{if $row['status']!=1 }
								{if $_G['isSuperAdmin'] && $_G['username']=='benben'}
								<br>{php echo $statustr[$row['status']+4];}
								{else}
								<br>{php echo $statustr2[$row['status']+4];}
								{/if}
								{/if}
							</td>
							<td  style="font-size: 10px;max-width: 100px;">{php echo date('Y-m-d',$row['addtime']);}<br>{php echo date('H:i:s',$row['addtime']);}{if !empty($system['wxapp'])}<br>{php echo $system['wxapp']==$row['uniacid']?'小程序':'H5链接';}{/if}</td>
							<td ><a href="https://www.baidu.com/s?wd={$row['ip']}" target="_blank">
									<span class="label label-info">{$row['ipaddress']}</span>
								</a></td>
							<td ><a href="{php echo createWebUrl('fans',array('themeid'=>$themeid,'workerid'=>$row['workerid'],'op'=>'display'));}" >{$row['workername']}<br>{$row['teamname']}<br>{php echo mb_substr($row['companyname'],0,6,'utf-8');}</a></td>
							<td style="text-align:right;">
								<a href="{php echo createWebUrl("comm", array('op' => 'edit','themeid'=>$themeid, 'id' => $row['id']));}" class="btn btn-info btn-sm"  title="虚拟数" data-toggle="tooltip" data-placement="top"><i class="fa fa-heart"> </i></a>

								{if $system['fenxiao'] == '1'}
								<a href="{php echo createWebUrl('commshare', array('op' => 'display','themeid'=>$themeid,'uid'=>$row['uid']));}" class="btn btn-warning btn-sm" title="查看红包记录" data-toggle="tooltip" data-placement="top"  return false;"><i class="fa fa-list"> </i></a>
								{/if}
								{if $_G['isSuperAdmin']}
								<a href="{php echo createWebUrl($do, array('op' => 'delete', 'uid' => $row['uid'],'themeid'=>$themeid));}" class="btn btn-warning btn-sm" title="删除" data-toggle="tooltip" data-placement="top" onclick="if(!confirm('删除后将不可恢复，确定删除吗?')) return false;"><i class="fa fa-times"> </i></a>
								{/if}
							</td>
						</tr>
						{/loop}
					</tbody>
				</table>
			</div>
		</div>
		{$pager}
	</form>
</div>

<script type="text/javascript">
	$(function(){
		$('.app-preview').click(function(){
			return false;
		});
		
			$(":checkbox[name='status[]']").bootstrapSwitch();
			$(':checkbox').on('switchChange.bootstrapSwitch', function(e, state){
				$this = $(this);
				var id = $(this).data('id');
				var status = this.checked ? 3 : 0;
				$.post("{php echo createWebUrl($do, array('op' => 'status','themeid'=>$themeid));}", {status:status,id: id}, function(resp){
					resp = $.parseJSON(resp);
					if(resp.message.errno != 0) {
						layer.msg('操作失败, 请稍后重试');
					} else {
						layer.msg('操作成功');
					}
				});
			});
	});
</script>
{/if}
